<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<div id="userForm">
<form:form id="userDetail" modelAttribute="userDetail" action="save" method="post">
    <span class="errors">
	<form:errors path="*"/>
    </span>
    <h2>User details</h2>
    <fieldset>
	<div class="field">
	    <div class="label">Name:</div>
	    <div class="input">
		<form:input id="username" path="username"/>
		<script type="text/javascript">
		    Spring.addDecoration(new Spring.ElementDecoration({
			elementId : "username",
			widgetType : "dijit.form.ValidationTextBox",
			widgetAttrs : {
                required : "true",
                promptMessage : "User login name",
                invalidMessage : "Username is required."
            }
            }));
		</script>
	    </div>
	</div>
	<div class="field">
	    <div class="label">Password:</div>
	    <div class="input">
		<form:password id="password" path="password"/>
		<script type="text/javascript">
		    Spring.addDecoration(new Spring.ElementDecoration({
			elementId : "password",
			widgetType : "dijit.form.ValidationTextBox",
			widgetAttrs : { required: "true", promptMessage : "User password" }}));  
		</script>
	    </div>
	</div>
	<div class="field">
	    <div class="label">Confirm Password:</div>
	    <div class="input">
		<form:password id="confirmPassword" path="confirmPassword"/>
		<script type="text/javascript">
		    Spring.addDecoration(new Spring.ElementDecoration({
			elementId : "confirmPassword",
			widgetType : "dijit.form.ValidationTextBox",
			widgetAttrs : { promptMessage : "Confirm user's password" }}));  
		</script>
	    </div>
	</div>
	
	<input type="hidden" name="id" value="${person.id}" />
	<div class="buttonGroup">
	    <!--
        <input type="submit" name="_eventId_proceed" value="Save"/>&#160;
	    -->
        <input type="submit" id="proceed" name="_eventId_proceed" value="Proceed" />&#160;
	    <script type="text/javascript">
		Spring.addDecoration(new Spring.AjaxEventDecoration({
        elementId: "proceed",
        event: "onclick",
        formId: "userDetail",
        params: { fragments: "userForm" }
        }));
        Spring.addDecoration(new Spring.ValidateAllDecoration({
            elementId:'proceed',
            event:'onclick'}));
	    </script>

        <!--
	    <input type="submit" id="proceed" name="_eventId_proceed" value="Proceed" onclick="Spring.remoting.submitForm('proceed', 'userDetail', {fragments:'messages,userForm'}); return false;"/>&#160;
	    <script type="text/javascript">
		Spring.addDecoration(new Spring.ValidateAllDecoration({
            elementId:'proceed',
            event:'onclick'}));
	    </script>
	    <input type="submit" name="_eventId_cancel" value="Cancel"/>&#160;
	    -->
	</div>
    </fieldset>
</form:form>
</div>